// 错误基类
class ServiceError extends Error {
  constructor(message, code) {
    super(message);
    this.code = code;
  }
}

// 文件上传错误
exports.UploadError = class UploadError extends ServiceError {
  constructor(message) {
    super(message, 413);
  }
};

// 401禁止访问错误
exports.ForbidenError = class ForbidenError extends ServiceError {
  constructor(message) {
    super(message, 401);
  }
};

// 验证错误
exports.ValidationError = class ValidationError extends ServiceError {
  constructor(message) {
    super(message, 406);
  }
};

// 404错误
exports.NotFoundError = class NotFoundError extends ServiceError {
  constructor() {
    super("not found", 404);
  }
};

// Unknown错误
exports.NotFoundError = class NotFoundError extends ServiceError {
  constructor() {
    super("service internal error", 500);
  }
};
